<%-- 
    Document   : pasajesPaso1
    Created on : 27/05/2014, 06:02:01 PM
    Author     : USUARIO
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>AdminLTE | Dashboard</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="../../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="../../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="../../css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
        <link href="../../css/AdminLTE.css" rel="stylesheet" type="text/css" />
    
        <script type="text/javascript">
            function cambiarP(sel)
            {   if(sel.value == "Ida")
                {   $("#ida").show();
                    $("#vuelta").hide();
                } else
                {   $("#ida").hide();
                    $("#vuelta").show();
                }
            }
        </script>
        
        
    </head>
    <body class="skin-blue">             
        
        <!-- header logo: style can be found in header.less -->
        <%@include file="../../jspf/header.jspf" %>
        <!-- header logo: style can be found in header.less -->
        
        
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">                
                <!-- sidebar: style can be found in sidebar.less -->
                <section class="sidebar">
                    <!-- Sidebar user panel -->
                    <div class="user-panel">
                        <div class="pull-left image">
                            <img src="../../img/avatar3.png" class="img-circle" alt="User Image" />
                        </div>
                        <div class="pull-left info">
                            <p>Hello, Jane</p>

                            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                        </div>
                    </div>
                    <!-- search form -->
                    <form action="#" method="get" class="sidebar-form">
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search..."/>
                            <span class="input-group-btn">
                                <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>
                    <!-- /.search form -->
                    
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    <%@include file="../../jspf/menu.jspf" %>
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    
                </section>
                <!-- /.sidebar -->
            </aside>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Pasajes
                        <small>Mantenedor</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                        <li class="active">Pasajes Paso 1</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box box-primary">
                                <div class="box-header">
                                    <h3 class="box-title">Mostrar Itinerarios</h3>                                    
                                </div><!-- /.box-header -->
                                <div class="box-body">
                                    <form action="../../ServletPasajes1" role="form">
                                        <input type="hidden" name="accion" value="showIti"/>
                                        <div class="row">
                                            <div class="col-xs-3">
                                                <label>Origen</label>
                                                <select class="form-control" name="pOri">
                                                    <option>Elegir origen..</option>
                                                    <% ModIti_Agencias a = new ModIti_Agencias();
                                                       ArrayList<ModIti_Agencias> listA = new ArrayList<ModIti_Agencias>();
                                                       listA = a.listarAgencias();
                                                       for(int i=0; i<listA.size(); i++)
                                                       {
                                                    %>
                                                    <option><%=listA.get(i).getCiudad()%></option>                                                 
                                                    <%
                                                       }
                                                    %>
                                                </select>
                                            </div>
                                            <div class="col-xs-3">
                                                <label>Destino</label>
                                                <select class="form-control" name="pDes">
                                                    <option>Elegir destino..</option>
                                                    <% ArrayList<ModIti_Agencias> listA2 = new ArrayList<ModIti_Agencias>();
                                                       listA2 = a.listarAgencias();
                                                       for(int i=0; i<listA2.size(); i++)
                                                       {
                                                    %>
                                                    <option><%=listA.get(i).getCiudad()%></option>                                                 
                                                    <%
                                                       }
                                                    %>
                                                </select>
                                            </div>
                                            <div class="col-xs-3">
                                                <label>&nbsp;</label> 
                                                <select class="form-control" id="tipser" onchange="cambiarP(this)" name="pTipPas">
                                                    <option value="Ida">Solo Ida</option>
                                                    <option value="IdayVuelta">Ida y Vuelta</option>
                                                </select>
                                            </div>
                                        </div><br/>
                                        <div class="row" id="ida">
                                            <div class="col-xs-3">
                                                <label>Fecha de Ida</label>
                                                <input type="date" class="form-control" name="pFecIda"/>
                                            </div>
                                        </div>
                                        <div class="row" id="vuelta" style="display:none;">
                                            <div class="col-xs-3">
                                                <label>Fecha de Ida</label>
                                                <input type="date" class="form-control" name="pFecIda2"/>
                                            </div>
                                            <div class="col-xs-3">
                                                <label>Fecha de Regreso</label>
                                                <input type="date" class="form-control" name="pFecReg2"/>
                                            </div>
                                        </div><br/>
                                        <div class="row">
                                            <div class="col-xs-5">
                                                <label>&nbsp;</label>
                                            </div>
                                            <div class="col-xs-2">
                                                <button type="submit" class="btn btn-primary">Mostrar Itinerarios</button>
                                            </div>
                                        </div><br/>
                                    </form>
                                    <%  ArrayList<ModIti_Servicios> list = (ArrayList<ModIti_Servicios>)session.getAttribute("sesBoletos");
                                        if(list != null)
                                        {
                                    %>
                                    <div class="row">
                                        <div class="col-xs-6">
                                            <h4 class="bg-navy pad" style="margin-bottom:0px;">Ida xx/xx/xxxx</h4>
                                            <table class="table table-bordered table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>Elegir</th>
                                                        <th>Hora de salida</th>
                                                        <th>Servicio</th>
                                                        <th>Bus</th>
                                                        <th>Precio</th>
                                                        <th>Disponible</th>
                                                        <th>Lleg. aprox.</th>
                                                    </tr>
                                                </thead>
                                                <tbody>                                                    
                                                    <% 
                                                        String h = null;
                                                        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");                
                                                        for(int i=0; i<list.size(); i++)
                                                        {
                                                    %>
                                                    <tr>
                                                        <td></td>
                                                        <% ModIti_Itinerario it = new ModIti_Itinerario().listarItinerarioByIdServicio(list.get(i).getId()); 
                                                           h = sdf.format(it.getHorasalida().getTime());
                                                        %>
                                                        <td><%=h%></td>
                                                        <td><%=list.get(i).getNombre()%></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                    </tr>
                                                    <%  } %>
                                                </tbody>
                                                <tfoot>
                                                    <tr>
                                                        <th>Elegir</th>
                                                        <th>Hora de salida</th>
                                                        <th>Servicio</th>
                                                        <th>Bus</th>
                                                        <th>Precio</th>
                                                        <th>Disponible</th>
                                                        <th>Lleg. aprox.</th>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                        
                                    <%     
                                        } else
                                        {
                                    %>
                                    <div class="col-xs-6">
                                        <div class="alert alert-info alert-dismissable">
                                            <i class="fa fa-info"></i>
                                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times</button>
                                            <b>Mensaje!&nbsp; No se encuentra itinerario para ese origen y destino</b>
                                        </div>
                                    </div>
                                    <%
                                        }
                                        ArrayList<ModIti_Servicios> listV = (ArrayList<ModIti_Servicios>)session.getAttribute("sesBoletosV");
                                        if(listV != null)
                                        {
                                    %>
                                    <div class="col-xs-6">
                                            <h4 class="bg-navy pad" style="margin-bottom:0px;">Vuelta xx/xx/xxxx</h4>
                                            <table class="table table-bordered table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>Elegir</th>
                                                        <th>Hora de salida</th>
                                                        <th>Servicio</th>
                                                        <th>Bus</th>
                                                        <th>Precio</th>
                                                        <th>Disponible</th>
                                                        <th>Lleg. aprox.</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <% 
                                                            for(int i=0; i<listV.size(); i++)
                                                            {
                                                    %>
                                                    <tr>
                                                        <td>8:00 a.m.</td>
                                                        <td>Lima - Huaraz | Directo</td>
                                                        <td><%=list.get(i).getNombre()%></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                    </tr>
                                                    <%}%>
                                                </tbody>
                                                <tfoot>
                                                    <tr>
                                                        <th>Elegir</th>
                                                        <th>Hora de salida</th>
                                                        <th>Servicio</th>
                                                        <th>Bus</th>
                                                        <th>Precio</th>
                                                        <th>Disponible</th>
                                                        <th>Lleg. aprox.</th>
                                                    </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    <%     
                                        } else
                                        {
                                    %>
                                    <div class="col-xs-6">
                                        <div class="alert alert-info alert-dismissable">
                                            <i class="fa fa-info"></i>
                                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times</button>
                                            <b>Mensaje!&nbsp; No se encuentra itinerario para ese origen y destino</b>
                                        </div>
                                    </div>
                                    <%
                                        }
                                    %>
                                    </div><br/>
                                    <div class="row">
                                        <div class="col-xs-5">
                                            <label>&nbsp;</label>
                                        </div>
                                        <div class="col-xs-6">
                                            <a href="pasajesPaso2.jsp">
                                                <button type="submit" class="btn btn-primary">Siguiente >></button>
                                            </a>
                                        </div>
                                    </div><br/>
                                </div>
                            </div><!-- /.box -->
                        </div>
                    </div>                    
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
        <script src="../../js/jquery.min.js"></script>
        <!-- Bootstrap -->
        <script src="../../js/bootstrap.min.js" type="text/javascript"></script>
        <!-- AdminLTE App -->
        <script src="../../js/app.js" type="text/javascript"></script>
    </body>
</html>